package xml;

import javax.xml.bind.annotation.adapters.*;
import java.awt.Point;

public class PointAdapter extends XmlAdapter<PointType, Point> {
	// adapt original Java construct to a type, NotificationsType,
	// which we can easily map to the XML output we want
	public PointType marshal(Point p) throws Exception {
		PointType pType = new PointType(p); 

		return pType;
	}

	// reverse operation: map XML type to Java
	public Point unmarshal(PointType pType) throws Exception { 
		Point p = new Point();
		p.setLocation(pType.getX(), pType.getY());
		
		return p;
	}
}